package com.example.online_order.mapper;

import com.example.online_order.pojo.AdminAccount;
import com.example.online_order.pojo.Desk;
import com.example.online_order.pojo.Shoppingcar;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ShoppingcarMapper {
    @Select("select * from shoppingcar")
    public List<Shoppingcar> getAllProducts();

    @Select("select * from shoppingcar where id = #{id}")
    public Shoppingcar getProductById(Integer id);
    @Insert("insert into shoppingcar (id,goodsName,goodsNum,price,userName,userId) values (#{id},#{goodsName},#{goodsNum},#{price},#{userName},#{userId})")
    public Integer addToCar(Shoppingcar product);

    @Delete("delete from shoppingcar where id =#{id}")
    public Integer deleteProduct(Integer id);

    @Update("update shoppingcar set price=#{price} where id = #{id}")
    public Integer updatePrice(Integer id,String price);
    @Update("update shoppingcar set goodsNum=#{goodsNum} where id = #{id}")
    public Integer updateQuantity(Integer id,String goodsNum);
}
